package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 还款方式
 * @author liaojunjun
 *
 */
@AllArgsConstructor
@Getter
public enum RepaymentTypeEnum {
	REPAY_PRINCIPAL_INTEREST_AT_TERM((byte)1, "到期还本付息",TianChengRepaymentTypeEnum.REPAY_PRINCIPAL_INTEREST_AT_TERM),
    AVERAGE_CAPITAL_PLUS_INTEREST ((byte)2, "等额本息",TianChengRepaymentTypeEnum.AVERAGE_CAPITAL_PLUS_INTEREST),
    MONTHLY_INTEREST_PAYMENT_DUE((byte)3, "先息后本",TianChengRepaymentTypeEnum.MONTHLY_INTEREST_PAYMENT_DUE);

    private Byte value;
    private String desc;
    private TianChengRepaymentTypeEnum tianChengRepaymentTypeEnum;

	public static RepaymentTypeEnum enumOf(int value) {
		for (RepaymentTypeEnum retEnum : values()) {
			if (retEnum.value == value) {
				return retEnum;
			}
		}
		throw new NoSuchEnumValueException("RepaymentTypeEnum:" + value);
	}
}
